<template>
  <el-container class="sum" style="height: 100vh;">
    <el-header>Header</el-header>
    <el-container>
      <el-aside width="8.75rem">
        <ul>
          <li v-for="item in menuItems" :key="item.name">
            <div @click="toggle(item)">
              <router-link :to="{path:item.path,query:{name:item.name}}">{{ item.name }}</router-link>
              <span v-if="item.children && item.open==false"><i class="el-icon-arrow-down"></i></span>
              <span v-if="item.children && item.open"><i class="el-icon-arrow-up"></i></span>
            </div>
            <ul v-if="item.children && item.open">
              <li v-for="child in item.children" :key="child.name">
                <router-link :to="{path:child.path,query:{name:child.name}}">{{ child.name }}</router-link>
              </li>
            </ul>
          </li>
        </ul>
      </el-aside>
      <el-main>
          <TopNav />
          <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
import TopNav from './TopNav.vue';
document.documentElement.style.fontSize=document.documentElement.clientWidth/1237.6*16+'px'
export default{
    components:{
      TopNav
    },
    data(){
      return{
        menuItems:[
          {name:'用户信息',path:'/home/userinfo'},
          {name:'oee测试',path:'/home/oee'},
          {name:'图形',path:'/home',open: false,children: [
            {name:'汇总图形',path:'/home/echarts'},
            {name:'单个图形',path:'/home/echarts1'},
          ]},
          {name:'状态时间',path:'/home/statistic'},
        ],
      }
    },
    methods: {
      toggle(item) {
        if (item.children) {
          item.open = !item.open;
        }
      }
    }
}
</script>
<style scoped lang="scss">
// #app {
//   font-family: Avenir, Helvetica, Arial, sans-serif;
//   -webkit-font-smoothing: antialiased;
//   -moz-osx-font-smoothing: grayscale;
//   text-align: center;
//   color: #2c3e50;
// }
// .el-row{
//   width: 25rem;
// }
li {
  // text-indent: 1.25rem; /* 设置文字缩进为20像素 */
  // background-color: #D3DCE6;
  // color: #333;
  list-style: none;
  // line-height: 12.5rem;
  // min-width: 8.75rem!important;
}
a {
  text-decoration: none;
  color: #333;
}
.el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    vertical-align:top;
    line-height: 3.75rem;
  }
  
  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    // text-align: left;
    line-height: 2rem;
    // display: flex;
    // justify-content: left;
  }
  .el-main {
    // background-color: #E9EEF3;
    // color: #333;
    text-align: center;
    // line-height: 10rem;
  }
  
  body > .el-container {
    margin-bottom: 2.5rem;
  }

  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
  }
  html{
    font-size: 16px;
  }
</style>